function q = ElnpX_ZmuLambda(mix, vars)

% E[ln p(X|Z, mu, Lamba)]

[K D] = size(mix.centres);

% statistics
sample_means = mix.sample_means;
sample_covars = mix.sample_covars;

% posteriors
m = mix.varposterior.m;
b = mix.varposterior.b;
W = mix.varposterior.W;
v = mix.varposterior.v;
weights = sum(vars.Z, 1);

% expectation of logdet
ElndetLambda = mix.varposterior.ElndetLambda;

q = 0;
for k = 1:K
    q = q + weights(k)*(ElndetLambda(k) - D/b(k) - v(k)*trace(sample_covars(:, :, k)*W(:, :, k)) ...
            - v(k)*(sample_means(k, :)-m(k, :))*W(:, :, k)*(sample_means(k, :)-m(k, :))' - D*log(2*pi));
end
q = 0.5*q;
